package com.tvunetworks.center.user.mapper;

import com.tvunetworks.center.user.model.OverWatch;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

/**
 * @author Etan Yang
 * @data: 6/17/2020 10:00 AM
 * @program: tvucc-aggregator
 * @description:
 */

public interface OverWatchMapper extends Mapper<OverWatch> {
    /**
     * 通过rid查询OverWatch
     * @param rid rid
     * @return OverWatch
     */
    OverWatch getOverWatchByRid(@Param("rid") String rid);

    /**
     * 通过rid查询OverWatch
     * @param tid tid
     * @return OverWatch
     */
    OverWatch getOverWatchByTid(@Param("tid")String tid);

    /**
     * 根据code查询OverWatch
     * @param code code
     * @return OverWatch
     */
    OverWatch getOverWatchByCode(@Param("code") String code);

    /**
     * 根据Rid修改code和maxConnect
     * @param id id
     * @param maxConnect maxConnect
     * @param code code
     * @return int
     */
    int updateMaxNumAndCode(@Param("id") String id, @Param("maxConnect") int maxConnect, @Param("code") String code);

    /**
     * 修改当前观看人数
     * @param rid rid
     * @param currConnect currConnect
     * @return int
     */
    int updateCurrConnect(@Param("rid") String rid, @Param("currConnect") int currConnect);

    /**
     * 根据rid和code获取OverWatch
     * @param rid rid
     * @param code code
     * @return OverWatch
     */
    OverWatch getOverWatchByRidAndCode(@Param("rid") String rid, @Param("code") String code);
}
